package jmine.tec.web.front.domain;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

import jmine.tec.persist.annotation.DiscriminatorComment;
import jmine.tec.report.impl.table.ReportTableBuilder;
import jmine.tec.web.front.report.RequestPropertyResolver;

import org.hibernate.validator.NotNull;

import bancosys.tec.component.Documentation;

/**
 * @author lundberg
 */
@Entity
@DiscriminatorValue("1")
@DiscriminatorComment("NUMERICO")
public class BackOfficeRequestPropertyBigDecimal extends BackOfficeRequestProperty {

    private Integer decimals;

    /**
     * @return the decimals
     */
    @NotNull
    @Column(name = "NUM_DEC", scale = 0, precision = 2)
    @Documentation("NUMERO DE CASAS DECIMAIS QUE DEVE SER APRESENTADO.")
    public Integer getDecimals() {
        return this.decimals;
    }

    /**
     * @param decimals the decimals to set
     */
    public void setDecimals(Integer decimals) {
        this.decimals = decimals;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUpReportColumn(ReportTableBuilder<BackOfficeRequest> builder) {
        builder.addNumberColumn(this.getMnemonic(), this.getDescription(), new RequestPropertyResolver(this), this.getDecimals());
    }
}
